import request from '@/axios'
import { UserParams, UserResponse } from './types'

export const getUsersApi = (params: UserParams) => {
  return request.get<UserResponse>({ url: '/admin/list', params })
}

export const deleteUserByIdApi = (ids: string[] | number[]) => {
  return request.delete({ url: '/admin/delete', data: { ids } })
}

export const saveUserApi = (data: any) => {
  return request[data.id != 0 ? 'put' : 'post']({
    url: data.id != 0 ? '/admin/edit' : '/admin/add',
    data
  })
}
